import request from '@/config/axios'

export interface ProductSkuVO {
  id: number
  productId: number
  name: string
  num: number
  unit: string
  oldPrice: number
  price: number
  expireTime: number
}

// 查询产品规格列表
export const getProductSkuPage = async (params) => {
  return await request.get({ url: `/system/product-sku/page`, params })
}

// 查询产品规格详情
export const getProductSku = async (id: number) => {
  return await request.get({ url: `/system/product-sku/get?id=` + id })
}

// 新增产品规格
export const createProductSku = async (data: ProductSkuVO) => {
  return await request.post({ url: `/system/product-sku/create`, data })
}

// 修改产品规格
export const updateProductSku = async (data: ProductSkuVO) => {
  return await request.put({ url: `/system/product-sku/update`, data })
}

// 删除产品规格
export const deleteProductSku = async (id: number) => {
  return await request.delete({ url: `/system/product-sku/delete?id=` + id })
}

// 导出产品规格 Excel
export const exportProductSku = async (params) => {
  return await request.download({ url: `/system/product-sku/export-excel`, params })
}

// 查看规格列表 TODO
export const getProductSkuList = async (id: number) => {
  return await request.get({ url: `/system/product-sku/list?productId=` + id })
}

// 查看规格列表 TODO
export const getProductSkuListByCode = async (code: string) => {
  return await request.get({ url: `/system/product-sku/list-by-code?productCode=` + code })
}
